<?php
ini_set("memory_limit", "10240M");
require_once __DIR__ . '/../autoloader.php';
use phpspider\core\phpspider;
use phpspider\core\requests;
use phpspider\core\selector;
$url="https://pixabay.com/zh/photos/download/bird-2823767.jpg";
$pathinfo = pathinfo($url);
    $fileext = $pathinfo['extension'];
    echo $fileext;
    if (strtolower($fileext) == 'jpeg')
    {
        $fileext = 'jpg';
    }
// 以纳秒为单位生成随机数
$filename = uniqid().".".$fileext;
    echo $filename;
// 在data目录下生成图片
$filepath = "../images/{$filename}";
echo $filepath;
// 用系统自带的下载器wget下载
exec("wget -q {$url} -O {$filepath}");

// 替换成真是图片url
$data = "images/{$filename}";
echo $data;
